package com.spsoft.vatoutinv.service.vmsfulloutinvoice;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.spsoft.core.model.Result;
import com.spsoft.core.model.bo.TokenUser;
import com.spsoft.vatoutinv.model.dto.statistics.InvoiceInfoDto;
import com.spsoft.vatoutinv.model.vo.statistics.InvoiceInfoVo;
import com.spsoft.vatoutinv.entity.vmsfulloutinvoice.VmsFullOutInvoiceDetails;
import com.spsoft.vatoutinv.model.dto.vmsfulloutinvoice.VmsFullOutInvoiceDTO;
import com.spsoft.vatoutinv.model.dto.vmsfulloutinvoice.VmsFullOutInvoiceDownloadDTO;
import com.spsoft.vatoutinv.model.dto.vmsfulloutinvoice.VmsFullOutInvoicePageDTO;
import com.spsoft.vatoutinv.model.vo.vmsfulloutinvoice.InvoiceDetailVO;
import com.spsoft.vatoutinv.model.vo.vmsfulloutinvoice.VmsFullOutInvoicePageVO;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;

/**
 * <p>
 * 数电发票信息表 服务类
 * </p>
 *
 * @author chenxudong
 * @since 2023-11-30
 */
public interface VmsFullOutInvoiceDetailsService extends IService<VmsFullOutInvoiceDetails> {

    /**
     * 分页查询 发票信息
     *
     * @param dto
     * @return
     */
    Result<IPage<VmsFullOutInvoicePageVO>> page(VmsFullOutInvoicePageDTO dto);

    /**
     * 下载发票PDF OFD格式
     *
     * @param dto
     * @throws Exception
     */
    void fileDownload(VmsFullOutInvoiceDownloadDTO dto) throws IOException;

    /**
     * 上传发票号码
     *
     * @param fphm 发票号码
     * @return
     */
    Result<String> uploadFphm(List<String> fphm);

    /**
     * 判断是否有 未上传 的已开发票
     */
    boolean checkUploadFull(String deptCode);

    /**
     * 回滚已开发票
     */
    Result<Object> rollBackInvoice(List<VmsFullOutInvoiceDTO> invoiceDTOList, TokenUser tokenUser);

    /**
     * 查询已开发票详情
     *
     * @param fphm 发票号码
     * @return
     */
    Result<InvoiceDetailVO> detail(String fphm);

    /**
     * 下载发票
     *
     * @param text
     * @param downloadType
     */
    void invoiceDownload(String text, String downloadType);

    /**
     * 下载发票PDF OFD格式
     *
     * @param fphms
     * @return
     * @throws Exception
     */
    HashMap<String, String> fileDownload(List<String> fphms, String type) throws Exception;

    /**
     * 已开发票-web端开具发票导入
     *
     * @param excelFile excel文件
     * @param zipFile zip文件
     * @param confirmFlag 是否确认覆盖标志
     */
    Result<Object> webImport(MultipartFile excelFile, MultipartFile zipFile, boolean confirmFlag);

    /**
     * 统计相关-发票信息统计
     *
     * @param invoiceInfoDto
     * @return
     */
    IPage<InvoiceInfoVo> queryInvoiceInfoStatistics(InvoiceInfoDto invoiceInfoDto);
}